package com.exchange.controller.app.playMent;

import com.exchange.interceptor.BaseValidator;
import com.exchange.interceptor.EnumError;
import com.jfinal.core.Controller;
import com.jfinal.kit.Ret;

public class PlayMentVaidator extends BaseValidator {

	protected void validate(Controller c) {
		setRet(Ret.fail());
    	this.setShortCircuit(true);//短路型验证
    	
    	String url = getActionKey();
    	if (url.equals("/app/playMent/add")) {
    		validateRequiredString("payType", "msg", EnumError.PAYMENT_NULL.getCode());
    		validateRequiredString("payName", "msg", EnumError.PAYMENT_NULL.getCode());
    		validateRequiredString("account", "msg", EnumError.PAYMENT_ACCOUNT_NULL.getCode());
    		validateRequiredString("userName", "msg", EnumError.PAYMENT_USERNAME_NULL.getCode());
        }
    	if (url.equals("/app/playMent/delete")) {
    		validateInteger("id", "msg", EnumError.PARAMETER_ARE_MISSING.getCode());
        }
    	if (url.equals("/app/playMent/priority")) {
    		validateInteger("id", "msg", EnumError.PARAMETER_ARE_MISSING.getCode());
        }
	}

}
